<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" th:href="@{/webjars/bootstrap/4.5.2/css/bootstrap.css}">
</head>
<body>

<div>
    <form th:action="@{/emp}" method="post">
        <div class="form-group">
            <span>LastName</span><br>
            <input type="text" name="lastName" class="form-control" th:value="${emp.lastName}">
        </div>

        <div class="form-group">
            <span>Email</span><br>
            <input type="email" name="email" class="form-control" th:value="${emp.email}">
        </div>

        <div class="form-group">
            <span>Gender</span><br>
            <div class="form-check">
                <input type="radio" name="gender" value="0" class="form-check-input" th:checked="${emp.gender==0}">
                <label class="form-check-label">男</label>
            </div>
            <div class="form-check">
                <input type="radio" name="gender" value="1" class="form-check-input" th:checked=" ${emp.gender==1}">
                <label class="form-check-label">女</label>
            </div>
        </div>

        <div class="form-group">
            <label>department</label>
            <select class="form-control" name="department.id">
                <option th:each="dept : ${depts}" th:value="${dept.id}" th:selected="${dept.id == emp.department.id}">
                    [[${dept.departmentName}]]
                </option>
            </select>
        </div>

        <div class="form-group">
            <span>Birth(yyyy-MM-dd)</span><br>
            <input type="date" name="birth" class="form-control" th:value="${emp!=null}?${#dates.format(emp.birth, 'yyyy-MM-dd HH:mm:ss')}">
        </div>

        <input type="submit" value="添加" class="btn btn-success">
    </form>
</div>

</body>
</html>